feat: update mcp-core prompt to match spec, add mcp list/get to mcp-client#2
Merged
alexhancock merged 4 commits intoFeb 22, 2025
Merged
Conversation
- add new endpoints `list_prompts` and `get_prompt` in the MCP client - update prompt model in mcp-core to make `description` and `arguments` optional, following MCP spec
salman1993
approved these changes
Feb 21, 2025
|
nit: you can add a prompt in the mcp-server example here: https://github.com/modelcontextprotocol/rust-sdk/blob/main/crates/mcp-server/src/main.rs. that'll make it easier to test from this mcp-client example: https://github.com/modelcontextprotocol/rust-sdk/blob/main/crates/mcp-client/examples/stdio_integration.rs |
implementing types to define them, similar to other methods
test both new methods
Contributor
Author
|
Added the examples, and changed the Router methods to be in-line with tools/resources, which is a breaking change since implementing types will need to define those. |
|
lgtm! i don't have write access in this repo |
alexhancock
self-requested a review
February 22, 2025 16:40
alexhancock
approved these changes
Feb 22, 2025
takumi-earth
pushed a commit
to earthlings-dev/rmcp
that referenced
this pull request
Jan 27, 2026
branben
pushed a commit
to branben/rust-sdk
that referenced
this pull request
Jun 29, 2026
…urns Result - Add strip_output() that strips title/description without validating type (Dale modelcontextprotocol#1) - Change schema_for_output to return Arc<JsonObject> instead of Result (Dale modelcontextprotocol#2) - Cache only Arc<JsonObject> success values, not Result (Dale modelcontextprotocol#3) - Remove dead unwrap_or_else panic paths in with_output_schema, ToolBase, and macros - Tighten test assertions from contains to assert_eq on type field (Dale modelcontextprotocol#4) - Update test_schema_for_output_rejects_primitive to accept_primitive (SEP-2106) Co-authored-by: Orca <help@stably.ai>
branben
pushed a commit
to branben/rust-sdk
that referenced
this pull request
Jun 29, 2026
…urns Result - Add strip_output() that strips title/description without validating type (Dale modelcontextprotocol#1) - Change schema_for_output to return Arc<JsonObject> instead of Result (Dale modelcontextprotocol#2) - Cache only Arc<JsonObject> success values, not Result (Dale modelcontextprotocol#3) - Remove dead unwrap_or_else panic paths in with_output_schema, ToolBase, and macros - Tighten test assertions from contains to assert_eq on type field (Dale modelcontextprotocol#4) - Update test_schema_for_output_rejects_primitive to accept_primitive (SEP-2106) Co-authored-by: Orca <help@stably.ai>
DaleSeo
pushed a commit
that referenced
this pull request
Jul 8, 2026
…2106) (#895) * fix: address PR review - schema_for_output no longer validates or returns Result - Add strip_output() that strips title/description without validating type (Dale #1) - Change schema_for_output to return Arc<JsonObject> instead of Result (Dale #2) - Cache only Arc<JsonObject> success values, not Result (Dale #3) - Remove dead unwrap_or_else panic paths in with_output_schema, ToolBase, and macros - Tighten test assertions from contains to assert_eq on type field (Dale #4) - Update test_schema_for_output_rejects_primitive to accept_primitive (SEP-2106) Co-authored-by: Orca <help@stably.ai> * test(rmcp): add non-object output schema tests for SEP-2106 Add tests verifying schema_for_output accepts non-object types: - test_tool_builder_methods: primitive (i32), array (Vec<String>), option - test_structured_output: tool returning Json<Vec<T>> and Json<i32> - test_json_schema_detection: Json<Vec<T>>, Result<Json<Vec<T>>,E>, Json<String> - tool_traits: ToolBase::output_schema with Vec<AddOutput> output type * test(rmcp): add missing edge case tests from code review Add tests identified during code review: - description stripping for primitive types - composition types (Option<String> with anyOf/oneOf/null) - cache correctness (Arc::ptr_eq for repeated calls) - schema_for_input rejecting array types (not just primitives) - schema_for_output accepting unit type () * feat!: mark schema_for_output return-type change as breaking This introduces SEP-2106: schema_for_output no longer validates or returns Result. The public signature changed, so bump major. * fix: address Dale's PR review - direct schema.get assertions, remove ArrayTool - Replace loose schema_str.contains(...) assertions with direct schema.get("type") equality checks in test_tool_builder_methods.rs and test_structured_output.rs - Remove redundant ArrayTool fixture and its round-trip serde_json::from_str test from tool_traits.rs since schema is already Arc<JsonObject> - Drop dead schema_str variable in test_structured_output.rs --------- Co-authored-by: Brandon Bennett <brandonbennett@macbookair.myfiosgateway.com> Co-authored-by: Orca <help@stably.ai> Co-authored-by: Brandon Bennett <brandonbennett@Pursuits-Air.lan>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Update
Promptstructs for align with MCP spec, and add list/get prompts to themcp-clientMotivation and Context
descriptionandargumentsare optional fields, use optional in the structsPromptArgumentsdescriptionandrequiredare optional toolist_promptsandget_promptmethod to theMcpClientTraitlist_promptsandget_promptto callprompts/listandprompts/getrespectivelystdioandsseclients to handleJsonRpcMessage::Errorresponses to send back to the user instead of doing nothingHow Has This Been Tested?
Tested locally with goose, and tested listing, and getting prompts and getting errors
Added implementation to
crates/mcp-server/src/main.rsand usage of it incrates/mcp-client/examples/stdio_integration.rsBreaking Changes
Promptstruct API has changeddescriptionandargumentsto beOption<T>PromptArgumentstruct API has changeddescriptionandrequiredto beOption<T>Router:get_promptandlist_promptare now required to be implemented by types that want toimpl Routerto keep it consistent with howtoolsandresourcesare handled.Types of changes
Checklist
Additional context